import request from '@/utils/request'
import { apiVersion } from '@/config'

// 全部推演任务
export function getAllGameSimulations(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/all`,
        method: 'get',
        data
    })
}
export function getGameSimulations(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation`,
        method: 'get',
        data
    })
}
/**
 * 获取非停止状态的列表
 * @param {} data 
 */
export function getGameSimulationMonitor(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/monitor`,
        method: 'get',
        data
    })
}
export function getGameSimulationsMonitor(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/monitor`,
        method: 'get',
        data
    })
}
/**
 * 添加推演任务
 * @param {} data 
 */
export function addGameSimulation(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation`,
        method: 'post',
        data: data
    })
}
/**
 * 添加推演任务-引用任务
 * @param {} data 
 */
 export function addGameSimulationFromSource(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/addFromSource`,
        method: 'post',
        data: data
    })
}
/**
 * 删除推演任务
 * @param {} data 
 */
export function delGameSimulation(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${data.id}`,
        method: 'delete',
        data: data
    })
}
/**
 * 更新推演任务
 * @param {} data 
 */
export function putGameSimulation(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation`,
        method: 'put',
        data: data
    })
}

/**
 * 啓動推演任务
 * @param {} data 
 */
 export function startGameSimulation(id) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${id}/start`,
        method: 'put',
    })
}
/**
 * 结束推演任务
 * @param {} data 
 */
 export function stopGameSimulation(id) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${id}/stop`,
        method: 'put',
    })
}
/**
 * 取得推演任务
 * @param {*} data 
 */
export function getGameSimulationDetail(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${data.id}`,
        noLoadding: true,
        method: 'get',
    })
}
/**
 * 获取podname
 * @param {*} data 
 */
export function getGameSimulationPodName(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${data.id}/podName`,
        noLoadding: true,
        method: 'get',
    })
}

/**
 * 获取最新记录
 * 
 */
 export function getLatestGameSimulation(data) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/latest`,
        noLoadding: true,
        method: 'get',        
        data
    })
}

/**
 * 获取分支曲线
 */
 export function getLogBranch(id) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${id}/logBranch/`,
        noLoadding: true,
        method: 'get',
    })
}

/**
 * 获取曲线
 */
 export function getlogRate(id) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${id}/logRate/`,
        noLoadding: true,
        method: 'get',
    })
}
/**
 * 获取曲线
 */
 export function getlogRateAbs(id) {
    return request({
        url: `/admin/${apiVersion}/game/simulation/${id}/logRateAbs/`,
        noLoadding: true,
        method: 'get',
    })
}
/**
 * 获取指标或图示数据详情
 * @param {*} data 
 */
export function metricData(data) {
return request({
    url: `/admin/${apiVersion}/game/simulation/${data.id}/metric/data`,
    noLoadding: true,
    headers: {
    "Content-Type": "application/x-www-form-urlencoded"
    },
    method: 'get',
    data
})
}
/**
 * 获取指标或图示名称
 * @param {*} data 
 */
export function metricKeys(data) {
return request({
    url: `/admin/${apiVersion}/game/simulation/${data.id}/metric/keys`,
    noLoadding: true,
    headers: {
    "Content-Type": "application/x-www-form-urlencoded"
    },
    method: 'get',
    data
})
}